<?php
namespace Widget;
use Minutes\Widget;
use Model\Comment;
class CommentsCount extends Widget
{
    public function __construct($data, $properties) {
        parent::__construct($data, $properties);
        $this->widgetView = 'commentsCount';
    }

    public function run() {
        if (isset($this->properties['postId'])) {
            $modelComment = new Comment();
            $this->data['commentsCount'] = $modelComment->getCommentsCount($this->properties['postId']);
        } else {
            throw new \Exception('Wrong paginator specified for widget');
        }

    }
}
